<%@ page contentType="text/html;charset=UTF-8" language="java"%>

<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html"%>
<%--STRUTS LAYOUT--%>
<%@ taglib uri="/WEB-INF/tld/struts-layout.tld" prefix="layout"%>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%--   --%>



<script language="javascript" type="text/javascript"
	src="/CSWeb/modules/denuncias/procesos/js/datetimepicker.js"></script>
<script language="javaScript"> 
	var flagVisa = 0;     
	function trim(cadena)
	{
		var indice=0;
		var cadAux="";
		if (cadena!=null)
			while (indice<cadena.length)
			{
				var c=cadena.charAt(indice);
				if (c!=' ') 
				{
					cadAux+=c; 
				}
				indice++;
			}
		return cadAux;
	}
	
	function mostrarCamposDenuncia(condicion){

		
		obj = document.getElementById("camposRobo");
		obj = obj.style;
		obj.display='none';
		
		obj = document.getElementById("camposAcTrans");
		obj = obj.style;
		obj.display='none';
		
		obj = document.getElementById("camposPerDoc");
		obj = obj.style;
		obj.display='none';

		if (condicion == '1'){
		obj = document.getElementById("camposRobo");
		obj = obj.style;
		obj.display='block';
		}
		
		if (condicion == '2'){
		obj = document.getElementById("camposAcTrans");
		obj = obj.style;
		obj.display='block';
		}
		
		if (condicion == '3'){
		obj = document.getElementById("camposPerDoc");
		obj = obj.style;
		obj.display='block';
		}
	}
	
	function winPopUp()
	{
		alert("Entro WinPopUp");
		var form = document.RegistrarDenunciaForm;
		form.btnLocalizar=true;
		return openpopup(form, '', '900', '600', event);
	}

var popUpWin=0;

function popUpWindow()

{
		var form = document.RegistrarDenunciaForm;
		form.btnLocalizar=true;
  popUpWin = open("/CSWebJ/registrarDenuncia.do", 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+450+',height='+350+',left='+10+', top='+10+',screenX='+10+',screenY='+10+'');

}



</script>



<layout:html locale="true" styleClass="FORM">

<script
	src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAPDUET0Qt7p2VcSk6JNU1sBTfNr5UEQLT8GRTB7pSzkC2Mqfn4hRK-i12rXVdHRCdEZNxKJmdvtm4Rg"
	type="text/javascript"></script>
<script
	src="http://www.google.com/uds/api?file=uds.js&v=1.0&key=ABQIAAAAPDUET0Qt7p2VcSk6JNU1sBTfNr5UEQLT8GRTB7pSzkC2Mqfn4hRK-i12rXVdHRCdEZNxKJmdvtm4Rg"
	type="text/javascript"></script>

<script
	src="http://www.google.com/uds/solutions/mapsearch/gsmapsearch.js"
	type="text/javascript"></script>

<script type="text/javascript">
	var map;
</script>

<layout:form action="/registrarDenuncia.do" styleClass="FORM"
	width="500">

	<layout:panel styleClass="FORM" key="form.persona">
		<layout:text key="formDetalle.codigo" property="CPersonal"
			styleClass="LABEL" />
		<layout:text key="formDetalle.nombre" property="XPersonal"
			readonly="true" styleClass="LABEL" />
		<html:hidden property="tipoPersona" value="1" />


		<layout:formActions>
			<layout:image property="btnBuscarDenunciante"
				altKey="image.buscar.alttext" srcKey="image.buscar"
				bundle="bundle.image">
			</layout:image>
		</layout:formActions>
	</layout:panel>
	<%-- 		<layout:submit>Registrar</layout:submit>--%>



	<layout:panel styleClass="FORM" key="DetalleDenuncia">
		<layout:date key="Fecha" property="SFDenuncia" isRequired="true"
			styleClass="LABEL" patternKey="dateFormat" />
		<%--			<layout:text key="Fecha" property=""  isRequired="true" styleClass="LABEL"/>--%>

		<layout:text key="Direccion" property="XLugar" isRequired="true"
			styleClass="LABEL" readonly="true">
			<layout:button onclick="openStrutsLayoutPopup('myPopup');">...</layout:button>
		</layout:text>
		<layout:popup styleId="myPopup" styleClass="FORM"
			key="denuncia.localizar.title">
			<layout:panel>
				<layout:row width="700">
					<layout:cell>
						<body onunload="GUnload()">

							<div id="mapsearch" style="width: 450px; height: 350px"></div>
							<script src="/CSWebJ/modules/comun/js/submits.js"
								type="text/javascript"></script>
							<script src="/CSWebJ/modules/comun/js/googleMapFunctions.js"
								type="text/javascript"></script>
							<script type="text/javascript">
								if (GBrowserIsCompatible()) {
									var map = new GMap2(document.getElementById("mapsearch"),{draggableCursor: 'crosshair'});
									map.addControl(new GLargeMapControl());
									map.addControl(new GMapTypeControl());
									map.setCenter(new GLatLng(-12.092702, -77.063255), 14);
									registrarMouseClickListener();
	<%--							map.setCenter(new GLatLng(-12.092702, -77.063255), zoom);--%>
								}
				    		</script>
							<html:hidden property="cadenaPuntos" />

						</body>
					</layout:cell>
					<%--					<layout:column width="100%">--%>
					<layout:cell width="100%">
						<layout:panel styleClass="FORM"
							key="denuncia.localizar.filtro.title" width="100%" height="100%"
							align="top">
							<%--							<layout:column width="100%" >--%>

							<layout:select key="denuncia.localizar.tipocalle"
								property="tipoCalle" styleClass="FIELD">
								<layout:option key="denuncia.localizar.seleccionar" value="-1"></layout:option>
								<layout:options collection="LISTA_TIPO_CALLE"
									labelProperty="label" property="value" sourceOf="calle" />
							</layout:select>
							<%--							<c:if test='${not empty listaCalles}'>--%>
							<layout:select key="denuncia.localizar.calle" property="calle"
								styleClass="FIELD">
								<layout:option key="denuncia.localizar.seleccionar" value="-1"></layout:option>
								<layout:optionsDependent collection="listaCalles"
									property="value" labelProperty="label" dependsFrom="tipoCalle" />
							</layout:select>
							<%--							</c:if>--%>
							<layout:text key="denuncia.localizar.descripcion"
								property="XBusquedaLugar" styleClass="FIELD">
							</layout:text>
							<html:hidden property="CLugar" value="" />
<%
String url = request.getContextPath();
url+="/dwr/interface/BeanUbicarLugar.js"; 
%>

<div id="header"></div>
<div id="body"></div>
<div id="footer"></div>
							<script type='text/javascript' src=<%=url%>></script>
							<script type='text/javascript' src='/CSWebJ/dwr/engine.js'>
							</script>
							<script type="text/javascript">
							    var form = document.RegistrarDenunciaForm;	
						        function getGPolygonCLugar()
							    {    
								    function f_mostrarResult(options)
								    {
								    	var geo = eval(options[0]);								    	
								    	form.CLugar.value=options[1];
								    	alert(form.CLugar.value);
								    	map.clearOverlays();	    	
								    	map.addOverlay(geo);
								    }
								    BeanUbicarLugar.mostrar(form.XBusquedaLugar.value,f_mostrarResult);    
							    }
							</script>
							<layout:formActions>
								<layout:img srcKey="image.buscarPosicion"
									altKey="image.buscarPosicion.alttext" bundle="bundle.image"
									onclick="getGPolygonCLugar();" />
							</layout:formActions>
							<layout:button onclick="setValuesToForm();">Cancelar
<%--									<layout:img srcKey="image.cerrar" altKey="image.cerrar.alttext"--%>
								<%--										bundle="bundle.image" />--%>
							</layout:button>
							<%--							</layout:column>--%>
						</layout:panel>
						<%--					</layout:column>--%>
					</layout:cell>
				</layout:row>
			</layout:panel>
		</layout:popup>

		<layout:select key="TipoDenuncia" property="CTipoDelito"
			value="CTipoDelito" onchange="mostrarCamposDenuncia(value)">
			<layout:options collection="TIPO_DELITO" property="value"
				labelProperty="label" />
		</layout:select>
	</layout:panel>
	<div id="camposAcTrans" style="display: none;">

		<layout:panel styleClass="FORM" key="AcTrans">

			<layout:text key="NrodePersonas" property="NPersonas"
				isRequired="true" styleClass="LABEL" />
			<layout:text key="NroDeHeridos" property="NHeridos" isRequired="true"
				styleClass="LABEL" />
			<layout:text key="NroDeVictimas" property="NVictimas"
				isRequired="true" styleClass="LABEL" />

		</layout:panel>

	</div>
	<%--ss--%>
	<div id="camposPerDoc" style="display: none;">
		<layout:panel styleClass="FORM" key="PerDoc">

			<layout:select key="TipDoc" property="CTipoDocumento">
				<%--				<layout:option value="Todos" ></layout:option>--%>
				<layout:options collection="TIPO_DOCUMENTO" property="value"
					labelProperty="label" />
			</layout:select>
		</layout:panel>
	</div>

	<div id="camposRobo" style="display: block;">
		<layout:panel styleClass="FORM" key="Robo">

			<layout:select key="SubDel" property="CSubTipoDelito">
				<layout:options collection="SUBTIPO_ROBO" property="value"
					labelProperty="label" />
			</layout:select>
		</layout:panel>
	</div>

	<layout:textarea key="denuncia.hecho" maxlength="1000" cols="70"
		rows="15" property="XDetallehecho" styleClass="TEXTAREA" />
	<layout:textarea key="denuncia.observacion" cols="70" rows="3"
		property="XObservacion" styleClass="TEXTAREA" />



	<layout:formActions>
		<layout:image property="btnRegistrar" altKey="image.registrar.alttext"
			srcKey="image.registrar" bundle="bundle.image">Registrar</layout:image>
	</layout:formActions>

</layout:form>
</layout:html>
